<?php
declare(strict_types=1);

namespace Dreamcat\Http\EnhanceClient;

use Psr\Http\Client\ClientExceptionInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;

/**
 * http客户端接口
 * @author vijay
 */
interface HttpClientInterface extends ClientInterface
{
    /**
     * @param int $timeOutMs 默认的超时时间
     * @return static 对象本身
     */
    public function setTimeOutMs(?int $timeOutMs): HttpClientInterface;

    /**
     * 发送请求
     * @param RequestInterface $request
     * @param int $timeOutMs 超时时间，单位毫秒，不传则使用默认
     * @return ResponseInterface
     * @throws ClientExceptionInterface If an error happens while processing the request.
     */
    public function sendRequest(RequestInterface $request, int $timeOutMs = null): ResponseInterface;
}

# end of file
